Skip to content

fix(flagd): handle sem_ver edge cases (v prefix, partial versions, numeric context, build metadata) - #197

Open
yuminn-k wants to merge 1 commit into
open-feature:mainfrom
yuminn-k:fix-sem-ver-edge-cases
Open

yuminn-k wants to merge 1 commit into
open-feature:mainfrom
yuminn-k:fix-sem-ver-edge-cases

Conversation

@yuminn-k

Copy link
Copy Markdown
Contributor

This PR

Makes the sem_ver targeting operator follow the flagd spec for four edge cases and enables the previously skipped @semver-edge-cases Gherkin scenarios.

  • v / V prefix is accepted (v1.0.0).
  • Partial versions are padded (1 and 1.0 become 1.0.0).
  • Integer and Float context values are converted to strings before parsing (1.2 as a Float).
  • Build metadata is dropped before comparing, so 1.0.0+other equals 1.0.0.

The parsing lives in one small parse_version helper in crates/flagd-evaluation-engine/src/targeting/semver.rs, and both operands go through it. The semver-edge-cases filter is removed from crates/flagd/tests/gherkin_targeting_test.rs.

Related Issues

Fixes #170

Notes

Before the change, with the filter removed, cargo test -p open-feature-flagd --test gherkin_targeting_test --features in-process reported 215 scenarios (198 passed, 2 skipped, 15 failed). After the change it reports 215 scenarios (213 passed, 2 skipped).

cargo test -p flagd-evaluation-engine passes, including a new unit test for parse_version.

How to test

git submodule update --init
cargo test -p flagd-evaluation-engine
cargo test -p open-feature-flagd --test gherkin_targeting_test --features in-process

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

This review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry.

Next included review available in 52 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1752127e-e208-4951-8cba-ec618d39dcbd
Commits

Reviewing files that changed from the base of the PR and between 4ff3134 and a4c76c3.

Files selected for processing: 2

  • crates/flagd-evaluation-engine/src/targeting/semver.rs
  • crates/flagd/tests/gherkin_targeting_test.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

…meric context, build metadata)

Signed-off-by: YuMin Kim <yuminkim.dev@gmail.com>

@EmiRZx EmiRZx left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked the CI log and the 20 @semver-edge-cases examples run and pass along with the new unit test. it conflicts with #196 in the test filter but that's trivial to resolve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[flagd] Support sem_ver operator edge cases

4 participants